﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Noodles.Core.Model;
using Noodles.Core.Repositories;

namespace NoodlesCms.Areas.Admin.Controllers
{
    public class CategoryController : Controller
    {
        //
        // GET: /Admin/Category/
        public NHibernateRepository repository { get; set; }

        public ActionResult Index()
        {
            return PartialView();            
        }

        [HttpPost]
        public ActionResult Index(Categories category)
        {
            category.CreateDate = DateTime.Now;
            category.UpdateDate = DateTime.Now;
            var blogRepository = DependencyResolver.Current.GetService<Noodles.Core.Repositories.IRepository>();
            blogRepository.Add(category);
            return RedirectToAction("Index","BlogPost");
        }

    }
}
